﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Final
{
    public enum Token_Type { LITERAL, VARIABLE, OPERATOR, PLACEHOLDER, SPECIAL }
    public enum Special_Type { S, SL, B, ICL }

    public abstract class Token
    {
        protected Token_Type type;

        public virtual Token_Type Type
        {
            get { return type; }
        }

        public virtual void Print_Type()
        {
            if ( type == Token_Type.LITERAL )
            {
                Console.WriteLine("LITERAL");
            }
            else if ( type == Token_Type.VARIABLE )
            {
                Console.WriteLine("VARIABLE");
            }
            else if ( type == Token_Type.OPERATOR )
            {
                Console.WriteLine("OPERATOR");
            }
            else
            {
                Console.WriteLine("No type? ERROR");
            }
        }
    }

    public class Token_Literal : Token
    {
        int literal;

        public Token_Literal(int lit)
        {
            type = Token_Type.LITERAL;

            literal = lit;
        }

        public int LITERAL
        {
            get { return literal; }
            set { literal = value; }
        }
    }

    public class Token_Variable : Token
    {
        string name;

        public Token_Variable(string s)
        {
            type = Token_Type.VARIABLE;
            name = s;
        }

        public string NAME
        {
            get { return name; }
            set { name = value; }
        }
    }

    public class Token_Operator : Token
    {
        char op;

        public Token_Operator(char o)
        {
            type = Token_Type.OPERATOR;
            op = o;
        }

        public char OPERATOR
        {
            get { return op; }
            set { op = value; }
        }
    }

    public class Token_PlaceHolder : Token
    {
        int position; //Location in Symbol table

        public Token_PlaceHolder(int position)
        {
            type = Token_Type.PLACEHOLDER;
            this.position = position;
        }

        public int POSITION
        {
            get { return position; }
            set { position = value; }
        }
    }

    public class Token_Special : Token
    {
        Special_Type special;

        public Token_Special(Special_Type st)
        {
            type = Token_Type.SPECIAL;
            this.special = st;
        }

        public Special_Type S_TYPE
        {
            get { return special; }
        }
    }
}
